package com.tangyuan.user.service.impl;

import com.github.pagehelper.PageInfo;
import com.tangyuan.common.result.Result;
import com.tangyuan.common.util.CommStatus;
import com.tangyuan.feignapis.video.IVideoFeignClient;
import com.tangyuan.model.User;
import com.tangyuan.user.mapper.UserSearchMapper;
import com.tangyuan.user.service.UserSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserVideoSearchImpl implements UserSearchService {

    @Autowired
    UserSearchMapper userSearchMapper;

    @Autowired
    private IVideoFeignClient videoFeignClient;

    @Override
    public Result userSearch(Integer pageNum, Integer pageSize,String name,String token) {
        User user = CommStatus.getUser(token);
        return Result.ok(new PageInfo<>(videoFeignClient.getVideoInfo(user.getId(),name,pageNum,pageSize)));
    }
}
